package com.api.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import com.api.common.jwt.TokenIgnore;
import com.api.common.reqres.Request;
import com.api.common.reqres.Response;
import com.api.model.request.CommodityDetailRequest;
import com.api.model.request.CommodityListRequest;
import com.api.model.response.CommodityDetailResponse;
import com.api.model.response.CommodityListResponse;
import com.api.service.CommodityService;

import io.swagger.annotations.ApiOperation;

/**
 * <p>
 * 商品
 * </p>
 *
 * @author cfp
 * @since 2019-10-17
 */
@TokenIgnore
@RestController
public class CommodityController {
	@Autowired
	private CommodityService commodityService;

	@ApiOperation(notes = "商品列表", value = "商品列表")
	@PostMapping(value = "/commodityList.do")
	public Response<CommodityListResponse> commodityList(@RequestBody Request<CommodityListRequest> request)
			throws Exception {
		return commodityService.commodityList(request);
	}

	@ApiOperation(notes = "商品详情", value = "商品详情")
	@PostMapping(value = "/commodityDetail.do")
	public Response<CommodityDetailResponse> commodityDetail(@RequestBody Request<CommodityDetailRequest> request)
			throws Exception {
		return commodityService.commodityDetail(request);
	}
}
